<link rel="stylesheet" href="{{asset(env('CDN_HOST').'/public/css/cart/footer.css')}}">
<div id="cart-footer" class="cart-footer">
    <div class="cft-left">
        删除
    </div>
    <a href="/cart">
        <div class="cft-right">
            完成
        </div>
    </a>
</div>
<script>
    $(".cft-left").on("click", function () {
        $cart_active = $(".circle-active")
        if ($cart_active.length == 0 || $cart_active.length < 1) {
            return false
        }
        loading.show()
        var data = {}
        for (var i = 0; i < $cart_active.length; i++) {
            var $parent = $cart_active.eq(i).parents('.list-box')
            var key = "cart" + $parent.attr("data-cart-id")
            if (typeof cart[key] == "undefined")
                continue
            data[i] = cart[key].cart
        }
        data["_token"] = csrf_token
        console.table(data);
        $.post("/api/delete_cart", data, function (e) {
            if (e.errorCode == 0) {
                window.location.reload()
            } else {
                loading.hide()
                alert(e.errorMsg)
            }
        })
    })
</script>